﻿using AutoMapper;
using Volo.Abp.Identity;
using WMSSystem.DYB;
using WMSSystem.DYB.Dto.Department;
using WMSSystem.DYB.Dto.Inboundmanagement.Input;
using WMSSystem.DYB.Dto.LocationManagement.Input;
using WMSSystem.DYB.Dto.LocationManagement.Output;
using WMSSystem.DYB.Dto.PositionManagement.Input;
using WMSSystem.DYB.Dto.PositionManagement.Output;
using WMSSystem.DYB.Dto.User;
using WMSSystem.DYB.Dto.WarehouseManagement;
using WMSSystem.DYB.Dto.WarehouseManagement.Input;
using WMSSystem.DYB.Dto.WarehouseManagement.Output;
using WMSSystem.WYJ;
using WMSSystem.WYJ.Dto;
using WMSSystem.YJ;
using WMSSystem.YJ.DTO.Input;
using WMSSystem.YJ.DTO.Out;
using WMSSystem.YSL;
using WMSSystem.YSL;
using WMSSystem.YSL.Dto.CodeRule;
using WMSSystem.YSL.Dto.CodeRule;
using WMSSystem.Domain.Workflow;
using WMSSystem.Application.Contracts.Workflow.Dto;

namespace WMSSystem;

public class WMSSystemApplicationAutoMapperProfile : Profile
{
    public WMSSystemApplicationAutoMapperProfile()
    {
        /* You can configure your AutoMapper mapping configuration here.
         * Alternatively, you can split your mapping configurations
         * into multiple profile classes for a better organization. */


        // 实体 <-> DTO 映射
        CreateMap<CodeRule, CodeRuleDto>();
        CreateMap<CreateOrUpdateCodeRuleDto, CodeRule>();
        CreateMap<CodeRule, CreateOrUpdateCodeRuleDto>();

        #region DYB
        CreateMap<CreateWarehouseDto, WarehouseManagement>();
        CreateMap<WarehouseManagement, CreateWarehouseDto>();
        CreateMap<GetUserListDto, IdentityUser>();
        CreateMap<IdentityUser, GetUserListDto>();
        CreateMap<GetDepartmentListDto, Department>();
        CreateMap<Department, GetDepartmentListDto>();
        CreateMap<CreateDepartmentDto, Department>();
        CreateMap<Department, CreateDepartmentDto>();
        CreateMap<CreateWarehouseDto, CreateWarehouseOutput>();
        CreateMap<WarehouseManagement,UpdateWarehouseInput>();
        CreateMap<WarehouseManagement, GetWarehouseOutput>();
        CreateMap<CreateLocationInput, LocationManagement>();
        CreateMap<LocationManagement, GetLoactionListOutput>();
        CreateMap<CreatePositioinInput,PositionManagement>();
        CreateMap<PositionManagement, GetPositionList>();
        CreateMap<PositionManagement, GetPosition>();
        CreateMap<LocationManagement, GetLoactionOutput>();
        CreateMap<UpdateWarehouseInput, WarehouseManagement>().ForAllMembers(opt => opt.Condition((src, dest, srcMember) => srcMember != null));
        CreateMap<CreateInventoryDetailsInput, InventoryDetails>();
        CreateMap<CreateInboundInput, Inboundmanagement>();
        #endregion

        #region WYJ

        CreateMap<WYJ_SalesReturn, CreateSalesReturnDto>();
        CreateMap<CreateSalesReturnDto, WYJ_SalesReturn>();
        CreateMap<CreateReturnDetails, WYJ_SalesNumber>();
        CreateMap<WYJ_SalesNumber, CreateReturnDetails>();
        CreateMap<WYJ_SalesOrder, CreateOrder>();
        CreateMap<CreateOrder, WYJ_SalesOrder>();
        #endregion


        #region YJ
        CreateMap<CreateCommoditiestableDTO, Commoditiestable>().ReverseMap();
        CreateMap<UpdateCommoditiestableDTO, Commoditiestable>().ReverseMap();
        CreateMap<PagingCommoditiesTableOut, Commoditiestable>().ReverseMap(); 
        CreateMap<AddData, Inventorytable>().ReverseMap();
        CreateMap<Inventorytable, PagingInventorytableIn>().ReverseMap();

        CreateMap<CreateTransferTableDTO, Transfertable>().ReverseMap();
        CreateMap<UpdateTransferTableDTO, Transfertable>().ReverseMap();
        CreateMap<PagingTransferTableOut, Transfertable>().ReverseMap();
        CreateMap<InventoryGoods, PagingDataOut>().ReverseMap();
        CreateMap<InventoryGoodsDTO, InventoryGoods>().ReverseMap();
        #endregion

        #region Workflow
        CreateMap<WorkflowInstance, WorkflowInstanceDto>();
        CreateMap<WorkflowApproval, WorkflowApprovalDto>();
        #endregion
    }
}
